package game.targets;

import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.physics.bullet.linearmath.btIDebugDraw;
import com.badlogic.gdx.physics.bullet.linearmath.btVector3;

public class DebugDraw extends btIDebugDraw{
	private int mode;
	ShapeRenderer sh;
	
	public DebugDraw(){
		sh=new ShapeRenderer();
	}
	@Override
	public void drawLine(btVector3 from, btVector3 to, btVector3 color){
		sh.setColor(color.getX(),color.getY(),color.getZ(),1);
		sh.line(from.getX(), from.getY(),from.getZ(),to.getX(),to.getY(),to.getZ());
	}
	
	@Override
	public void reportErrorWarning(String warningString){
		System.err.println(warningString);
	}
	
	@Override
	public void setDebugMode(int i){
		mode=i;
	}
	
	@Override
	public int getDebugMode(){
		return mode;
	}
	
	public void begin(PerspectiveCamera camera) {
        sh.begin(ShapeType.Line);
        sh.setProjectionMatrix(camera.combined);
    }

    public void end() {
        sh.end();
    }

}
